package com.test.sort;

public class MaoPaoSort {

	public static void main(String[] args) {
		int[] arr = new int[10];
		for(int i = 0;i<10;i++){
			arr[i] = (int) Math.round(Math.random()*10);
		}

		for(int i = 0;i<arr.length;i++){
			System.out.print(arr[i]+",");
		}
		System.out.println();
		for (int i = 0,arrLen = arr.length; i < arrLen; i++) {
			for (int j = 0; j < arrLen - i - 1; j++) {
				if(arr[j] < arr[j+1]){
					int temp = arr[j];
					arr[j] = arr[j+1];
					arr[j+1] = temp;
				}
			}

			for(int k = 0;k<arr.length;k++){
				System.out.print(arr[k]+",");
			}
			System.out.println();
		}
	}
}
